package com.example.substation.common;

public class FrameException extends RuntimeException {
    private static final long serialVersionUID = 4144274698967309855L;

    private int code;
    private String message;


    public FrameException() {
        code = 69999;
        message = "initialized";
    }

    public FrameException(FrameException exception) {
        code = exception.getCode();
        message = exception.getMessage();
//		System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>" + message);
    }

    public FrameException instance() {
        return new FrameException().setCode(code).setMessage(message);
    }

    public FrameException error() {
        throw new FrameException().setCode(code).setMessage(message);
    }

    public int getCode() {
        return code;
    }

    public FrameException setCode(int code) {
        this.code = code;
        return this;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public FrameException setMessage(String message) {
        this.message = message;
        return this;
    }

    public FrameException addMessage(String message) {
        this.message += message;
        return this;
    }
}
